package com.aplikata.evok.bo;

import java.util.HashSet;
import java.util.Set;

import com.aplikata.bo.Role;

/**
 * @ClassName: Therapy
 * @Description: TODO
 * @author Huyun
 * @date 15. 5. 2012. 14:55:36
 */
public class Therapy implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Long id;
	private Therapy parent;
	private String name;
	private Integer sort;
	private Integer level;
	private Integer status;
	
	private Set<PatientTherapy> patientTherapies = new HashSet<PatientTherapy>(0);
	private Set<Therapy> children = new HashSet<Therapy>(0);
	private Set<Role> roles = new HashSet<Role>(0);

	public final static String QY_FIND_FIRST_LEVEL = "Therapy.findFirstLevel";
	public final static String QY_FIND_BY_ROLE = "Therapy.findByRole";

	public final static String LB_CATEGORY = "therapy_category";
	
	// Constructors

	/** default constructor */
	public Therapy() {
	}

	/** minimal constructor */
	public Therapy(Therapy parent) {
		this.parent = parent;
	}

	public Therapy(Integer status) {
		this.status = status;
	}

	public Therapy(Therapy parent, Integer status) {
		this.parent = parent;
		this.status = status;
	}

	// Property accessors

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getSort() {
		return this.sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public Therapy getParent() {
		return parent;
	}

	public void setParent(Therapy parent) {
		this.parent = parent;
	}

	public Set<PatientTherapy> getPatientTherapies() {
		return patientTherapies;
	}

	public void setPatientTherapies(Set<PatientTherapy> patientTherapies) {
		this.patientTherapies = patientTherapies;
	}

	public Set<Therapy> getChildren() {
		return children;
	}

	public void setChildren(Set<Therapy> children) {
		this.children = children;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null)
			return false;
		if (!(o instanceof Therapy))
			return false;
		if (isNew() || ((Therapy) o).isNew())
			return false;
		else
			return getId().equals(((Therapy) o).getId());
	}

	public boolean isNew() {
		return getId() == null;
	}
}